       IDENTIFICATION DIVISION.
       PROGRAM-ID. XRMFCB.
       AUTHOR. DENNIS OLENICK, OPT-TECH DATA PROCESSING.
      ***************************************************
       ENVIRONMENT DIVISION.
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT SAMPLE-DATA ASSIGN DISK "SAMP.DAT"
           ORGANIZATION IS LINE SEQUENTIAL.
           SELECT SCREEN-OUTPUT ASSIGN DISPLAY "CON:"
           ORGANIZATION IS LINE SEQUENTIAL.

       DATA DIVISION.
       FILE SECTION.
       FD SAMPLE-DATA
           LABEL RECORDS ARE STANDARD.
       01  IO-AREA       PIC X(75).
       FD SCREEN-OUTPUT
           LABEL RECORDS ARE STANDARD.
       01  OUTPUT-AREA   PIC X(75).
       WORKING-STORAGE SECTION.	     
       01  FUNC          PIC 9(4) COMP-5.
       01  LEN           PIC 9(4) COMP-5.
       01  RET-CODE      PIC 9(4) COMP-5.
       01  RET-CODE-DISP PIC 9(5).
      ***************************************************
       PROCEDURE DIVISION.
       MAINLINE.
           OPEN INPUT SAMPLE-DATA.
           OPEN OUTPUT SCREEN-OUTPUT.
      *SET UP FOR INITIALIZATION CALL FUNC=1 
       SET-UP. 
           MOVE 1 TO FUNC.
           MOVE 'S(1,10,C,A)' TO IO-AREA.
           MOVE 20 TO LEN.
           CALL '__RMFCB' USING FUNC, IO-AREA, LEN, RET-CODE.
           IF RET-CODE NOT EQUAL 0 GO TO ERROR-AREA.

      *PASS RECORDS TO OPT-TECH SORT FUNC=2 
       PASS-RECORDS.
           MOVE 2 TO FUNC.
           READ SAMPLE-DATA RECORD AT END GO TO RECIEVE-RECORDS.
           MOVE 100 TO LEN.
           CALL '__RMFCB' USING FUNC, IO-AREA, LEN, RET-CODE.
           IF RET-CODE NOT EQUAL 0 GO TO ERROR-AREA.
       	   GO TO PASS-RECORDS.

      *RECIEVE SORTED RECORDS BACK FUNC=3
       RECIEVE-RECORDS.
           MOVE 3 TO FUNC.
           CALL '__RMFCB' USING FUNC, IO-AREA, LEN, RET-CODE.
           IF RET-CODE EQUAL 1 STOP RUN
           IF RET-CODE NOT EQUAL 0 GO TO ERROR-AREA.
           WRITE OUTPUT-AREA FROM IO-AREA.
           GO TO RECIEVE-RECORDS.

       ERROR-AREA.
           MOVE RET-CODE TO RET-CODE-DISP.
           DISPLAY 'RET-CODE=', RET-CODE-DISP.
           STOP RUN.

